Skip to content

Adding a view that layouts with NotAutoLayout framework#8

Merged
lucdion merged 6 commits intolayoutBox:masterfrom
el-hoshino:NotAutoLayout
May 24, 2018
Merged

Adding a view that layouts with NotAutoLayout framework#8
lucdion merged 6 commits intolayoutBox:masterfrom
el-hoshino:NotAutoLayout

Conversation

@el-hoshino
Copy link
Copy Markdown

Hi.

I made a framework called NotAutoLayout, which also uses pure code to layout subviews without Auto Layout constraints. Please have a check.

Layout result of NotAutoLayout:
simulator screen shot - iphone x - 2018-05-23 at 19 04 49

Result comparison between Manual Layout and NotAutoLayout
2018-05-23 19 06 22

Log of "Run all benchmarks" and "NotAutoLayout":

seconds/ops for each iterations (10, 20, ..., 100)
-------------------------------------
Auto Layout	0.0444651323816051	0.062598429620266	0.0872605045636495	0.114955239825779	0.140841349959373	0.170377850532532	0.18577386935552	0.220360970497131	0.245990610122681	0.256780433654785	
FlexLayout 1.3	0.00857571149483705	0.0116720338200414	0.0148590364876915	0.0195182126301986	0.0222573624716865	0.0258650596325214	0.0280893411901262	0.0321924015879631	0.0359513248716082	0.0392559629220229	
LayoutKit 7.0	0.00832798067203238	0.010320017018269	0.0130182674952916	0.0157572645694017	0.0183632612228394	0.0206511361258371	0.0230229632420973	0.0263351515719765	0.02790457672543	0.0309160586559411	
Manual Layout	0.00876405446425728	0.0118236219181734	0.0152513854431384	0.0187998414039612	0.0215916735060672	0.0252093523740768	0.0290884017944336	0.0325486736912881	0.0354839028983281	0.0388502661998455	
NotAutoLayout	0.00860644507611919	0.0114707892591303	0.0145809166673301	0.0171118025052345	0.0209920555353165	0.0237203281979228	0.0267151688274584	0.0322375036776066	0.0323677832080472	0.0362927062170846	
PinLayout 1.7	0.00705846934251382	0.00956428050994873	0.0115817593432021	0.0134502140680949	0.0162356745812201	0.0182195533405651	0.0214754317669158	0.0229623534462669	0.0254692912101746	0.0284786654843224	
UIStackView	0.0579119986957974	0.088265061378479	0.122330665588379	0.150926419666835	0.189715345700582	0.225884795188904	0.263017201423645	0.296218824386597	0.32682580947876	0.359041380882263	
Completed!

seconds/ops for each iterations (10, 20, ..., 100)
-------------------------------------
  114.61	ops/s	   0.009	seconds/ops	   115	iterations	10	subviews	NotAutoLayout
   81.99	ops/s	   0.012	seconds/ops	    82	iterations	20	subviews	NotAutoLayout
   69.14	ops/s	   0.014	seconds/ops	    70	iterations	30	subviews	NotAutoLayout
   55.98	ops/s	   0.018	seconds/ops	    56	iterations	40	subviews	NotAutoLayout
   48.19	ops/s	   0.021	seconds/ops	    49	iterations	50	subviews	NotAutoLayout
   41.25	ops/s	   0.024	seconds/ops	    42	iterations	60	subviews	NotAutoLayout
   36.88	ops/s	   0.027	seconds/ops	    37	iterations	70	subviews	NotAutoLayout
   35.23	ops/s	   0.028	seconds/ops	    36	iterations	80	subviews	NotAutoLayout
   30.99	ops/s	   0.032	seconds/ops	    32	iterations	90	subviews	NotAutoLayout
   27.96	ops/s	   0.036	seconds/ops	    28	iterations	100	subviews	NotAutoLayout
NotAutoLayout	0.00872535498245903	0.0121961643056172	0.0144628286361694	0.0178649255207607	0.0207502525679919	0.0242436329523722	0.0271157735102885	0.0283811357286241	0.0322684720158577	0.0357708888394492	

@lucdion
Copy link
Copy Markdown
Member

lucdion commented May 23, 2018

Hi @el-hoshino, thanks for adding your framework!

Could you try to update the layout to match the one from LayoutKit, which is the reference I use for all layouts, except those that was already existing (autolayout and UIStackView). See https://github.com/layoutBox/LayoutFrameworkBenchmark/blob/master/docs_markdown/benchmark_result_LayoutKit.png

Required:

  • Missing paddings all around views
  • poster name + title + timestamp should be vertically centered with the 50x50 image
  • missing margins between many views
  • ...

@el-hoshino
Copy link
Copy Markdown
Author

Hi @lucdion, thanks for your review.

I'm updating my sample code now, and I found that only LayoutKit has an additional "2nd" label on the right side of poster name label, other samples like PinLayout and FlexLayout don't have this one. Should I implement this label on my sample?

…ditional subviews that may slow down the layout process, but easier to understand the layout via code
@el-hoshino
Copy link
Copy Markdown
Author

el-hoshino commented May 23, 2018

Hi @lucdion

I've updated my sample code to match the layout from LayoutKit (or actually it was kind of difficult to read LayoutKit's code... so some of the implementations are from FlexLayout and PinLayout, but anyway paddings and margins around views are added now, and poster image is also vertically centered with those poster labels now.

Here's the screenshots on iPhone X and iPhone SE:

simulator screen shot - iphone x - 2018-05-24 at 04 03 32

simulator screen shot - iphone se - 2018-05-24 at 04 04 09

Also here's a new log of all benchmarks: (I'm using another computer now so the results may be very different from the old log)

seconds/ops for each iterations (10, 20, ..., 100)
-------------------------------------
Auto Layout	0.0486564749763125	0.0789526700973511	0.113672216733297	0.142112642526627	0.173426647981008	0.212768220901489	0.250551819801331	0.270187044143677	0.311900234222412	0.343671178817749	
FlexLayout 1.3	0.0108966788519984	0.0163464430839785	0.0203984332084656	0.0251854687929153	0.02933030128479	0.0338239351908366	0.0380328717055144	0.0425496647755305	0.0458871126174927	0.0501276910305023	
LayoutKit 7.0	0.0142315458244001	0.0199406147003174	0.0258124822225326	0.0318559110164642	0.0373490077477914	0.0433929612239202	0.0486717110588437	0.0542295167320653	0.0608607600716984	0.0660520270466805	
Manual Layout	0.0154459531490619	0.022968668829311	0.0298784585560069	0.0368530665125166	0.0440848858460136	0.0519565165042877	0.0600972175598145	0.0670293887456258	0.0742364270346505	0.084293931722641	
NotAutoLayout	0.0132579442701842	0.0180327019521168	0.0225512901941935	0.0270275755932457	0.0314559638500214	0.035545825958252	0.0409720802307129	0.0488930032366798	0.0492834761029198	0.0534357836371974	
PinLayout 1.7	0.0135176584527299	0.0193697557999538	0.0256495108971229	0.0309170231674657	0.0364585646561214	0.0456861853599548	0.0481453396025158	0.0541553622797916	0.0601801942376529	0.0663456693291664	
UIStackView	0.065653882920742	0.105512368679047	0.14726642199925	0.187819341818492	0.228378200531006	0.266939210891724	0.306461381912231	0.347361779212952	0.383745002746582	0.421917009353638	
Completed!

@lucdion
Copy link
Copy Markdown
Member

lucdion commented May 23, 2018

Last thing, could you update the README to include the reference to your framework.
Currently the update of graphics/charts is not automated, I will soon update them and it will include your framework.

Copy link
Copy Markdown
Member

@lucdion lucdion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the README.

@el-hoshino
Copy link
Copy Markdown
Author

I've added the reference to my framework, please have a check 👍

Copy link
Copy Markdown
Member

@lucdion lucdion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@lucdion lucdion merged commit 71c4199 into layoutBox:master May 24, 2018
@lucdion
Copy link
Copy Markdown
Member

lucdion commented Jul 5, 2018

@el-hoshino I've updated all charts, including NotAutoLayout

@el-hoshino
Copy link
Copy Markdown
Author

@lucdion Thanks a lot 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants